import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 商品定价-配置信息 */
export interface PriceConfig {
  id: number; // 编号
  configName?: string; // 参数名称
  configKey?: string; // 参数键名
  configValue?: string; // 参数键值
}

// 商品定价-配置 API
export const PriceConfigApi = {
  // 查询商品定价-配置分页
  getPriceConfigPage: async (params: any) => {
    return await request.get({ url: `/operation/price-config/page`, params })
  },

  // 查询商品定价-配置详情
  getPriceConfig: async (id: number) => {
    return await request.get({ url: `/operation/price-config/get?id=` + id })
  },

  // 新增商品定价-配置
  createPriceConfig: async (data: PriceConfig) => {
    return await request.post({ url: `/operation/price-config/create`, data })
  },

  // 修改商品定价-配置
  updatePriceConfig: async (data: PriceConfig) => {
    return await request.put({ url: `/operation/price-config/update`, data })
  },

  // 删除商品定价-配置
  deletePriceConfig: async (id: number) => {
    return await request.delete({ url: `/operation/price-config/delete?id=` + id })
  },

  /** 批量删除商品定价-配置 */
  deletePriceConfigList: async (ids: number[]) => {
    return await request.delete({ url: `/operation/price-config/delete-list?ids=${ids.join(',')}` })
  },

  // 导出商品定价-配置 Excel
  exportPriceConfig: async (params) => {
    return await request.download({ url: `/operation/price-config/export-excel`, params })
  }
}
